<html>
	<head>
		<title>identifyVerify.html</title>
		<meta http-equiv="content-type" content="text/html; charset=utf-8">
		<link href="../../css/general1.css" rel="stylesheet" type="text/css" />

		<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
		<link href="style/css.css" rel="stylesheet" type="text/css" />
		<link href="../../zephyr/css/drift.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../../zephyr/js/Util.js"></script>
		<script type="text/javascript" src="../../script/hiawardbpm.js"></script>
		<script type="text/javascript" src="../../script/prototype.js"></script>
		<script type="text/javascript" src="/vchzms-hiaward/dwr/interface/Ocx.js"></script>
		<script type="text/javascript" src="/vchzms-hiaward/dwr/engine.js"> </script>
	    <script type="text/javascript" src="/vchzms-hiaward/dwr/util.js"> </script>
		<script type="text/javascript" src="/vchzms-hiaward/dwr/interface/OutService.js"></script>
		<script type="text/javascript" src="/vchzms-hiaward/dwr/interface/Dao.js"></script>
		<script type="text/javascript">
    function subForm(msg){
          var webData=buildWebData(msg);
          var xmlMsg=window.dialogArguments;
          alert(xmlMsg.getXmlDocument().xml);
          xmlMsg.setCommand(12);
          xmlMsg.setWebData(webData);
          xmlMsg.buildXML();
          var url="/vchzms-hiaward/ProcessAjaxHandler";
          alert(xmlMsg.getXmlDocument().xml);
          new Ajax.Request(url,{
          method:'post',
          postBody:xmlMsg.getXmlDocument().xml,
          contentType:'application/x-www-form-urlencoded',
          encoding:'UTF-8',
          onComplete:function(transport){
	          try{
		          if(200==transport.status){
		               alert('成功创建了一个新任务');
		               window.close();
		              }
		          if(400==transport.status){
		               alert('创建失败');
		              }
	          }catch(err){
	              alert('js异常');
	          }
          }
       });
         }
         function buildWebData(msg){
         var xmlMsg=window.dialogArguments;
	     var vchsid=xmlMsg.getWebData().getProperty('vchsid');
          var webData=new WebData();
          webData.setProperty('vchsidInput',vchsid);
          webData.setProperty('idstate',msg);
          return webData;
         }
         //查询客户信息和票据信息的函数
         function getVoucherInfo(){
		 var xmlMsg=window.dialogArguments;
	     var vchsid=xmlMsg.getWebData().getProperty('vchsid');
         Dao.getVoucherById(vchsid,function(rr){
         var vd=rr.vchdate;
          $("accno").innerHTML=rr.accno;
          $("vchno").innerHTML=rr.vchno;
          $("amount").innerHTML=rr.amount;
          $("vchtype").innerHTML=rr.vchtype;
          $("vchdate").innerHTML=rr.vchdate;
          $("exchno").innerHTML=rr.exchno;
          //if(rr.batno!=null){
          //$("batno").innerHTML=rr.batno;
          //}
          var accnoTemp=rr.accno;
              OutService.Z_BAPI_ACCOUNT_INFO(accnoTemp,function(data){
              alert("--------");
              var custid=data.custId;
              $("coName").innerHTML=data.accName;
              OutService.Z_BAPI_BP_GET_ORG_DETAIL(custid,function(data){
                $("connector").innerHTML=data.connector;
                $("tel").innerHTML=data.tel;
              });
           });
          });
            
		}
        //调用页面验印控件的函数
		function invokeOCX(commandid, xml){
		    var xmldata = xml;
		    var commandid = commandid;
		   	var DOcxtest1 = document.getElementById("idVerifyOcx");		
		    var varRet = null;
		    if (xmldata) {
		        varRet = DOcxtest1.Zms(commandid, xmldata);
		    }
		    //alert("调用控件返回xml信息: " + varRet); //调用控件返回xml信息
		}
		
		//请求验印XML
		function getTradeXML(){
		    var xmlMsg = window.dialogArguments;
		    var vchsid = xmlMsg.getWebData().getProperty('vchsid');
			Dao.getVoucherById(vchsid,function(res){
				var vchdate = res.vchdate;
				Ocx.getIdTradeXML(vchsid, vchdate, '',1, function(xml){
					invokeOCX(1014, xml);
				});
			});
		}
		
		//保存验印结果
		function saveIdResult() {
			var DOcxtest1 = document.getElementById("idVerifyOcx");		
		    var varRet = DOcxtest1.Zms(1006, "");
		    //alert("调用控件返回xml信息: " + varRet); //调用控件返回xml信息
			
			var xmlMsg = window.dialogArguments;
		    var vchsid = xmlMsg.getWebData().getProperty('vchsid');
			//alert(vchsid);
			Ocx.saveIdResult(1006, varRet, vchsid, function(res){
		        //alert(res);
			});
		}
  </script>
	</head>

	<body onLoad="initMask();getTradeXML()">
		<div id="fade" class="black_overlay"></div>
		<center>
			<table width="800" border="1" cellspacing="0" cellpadding="0"
				class="tablist1">
				<tr>
					<td width="65%" height="80">
				  <table width="97%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td>
									<object id="idVerifyOcx" name="idVerifyOcx" on
										classid="clsid:4E2CEA6C-A572-40EA-80FE-EC78F1CFA756" width=410
										height=428 align=middle hspace=10 vspace=10 viewastext>
								                        </object>
								</td>
							</tr>
						</table>
					</td>
			  <td width="35%" height="" valign="top">
						<span style="width: 35%" class="title1"> <a name="tag"
							class="selectli1">客户信息</a> </span>
	  <table width="100%" border="0" cellpadding="0" cellspacing="0"
							class="tablist1">
							<tr>
								<td width="30%">
									公司名称:								</td>
						  <td width="70%">
									<span id="coName"></span>								</td>
		  </tr>
							<tr>
								<td>
									联系人:
								</td>
								<td>
									<span id="connector"></span>
								</td>
							</tr>
							<tr>
								<td>
									联系电话:
								</td>
								<td>
									<span id="tel"></span>
								</td>
							</tr>
							<tr>
								<td>
									备注:
								</td>
								<td>
									<span id="remark"></span>
								</td>
							</tr>
						</table>
						<span style="width: 35%" class="title1"> <a name="tag"
							class="selectli1">票据信息</a> </span>
						<table width="100%" border="0" cellpadding="0" cellspacing="0"
							class="tablist1">
							<tr>
								<td width="30%" height="29">
									账号:								</td>
						  <td width="70%">
									<span id="accno"></span>								</td>
						  </tr>
							<tr>
								<td height="34">
									凭证号:
								</td>
								<td>
									<span id="vchno"></span>
								</td>
							</tr>
							<tr>
								<td height="34">
									凭证类型:
								</td>
								<td>
									<span id="vchtype"></span>
								</td>
							</tr>
							<tr>
								<td height="34">
									凭证日期:
								</td>
								<td>
									<span id="vchdate"></span>
								</td>
							</tr>
							<tr>
								<td height="34">
									凭证金额:
								</td>
								<td>
									<span id="amount"></span>
								</td>
							</tr>
							<tr>
								<td height="34">
									提入机构:
								</td>
								<td>
									<span id="exchno"></span>
								</td>
							</tr>
							<tr>
								<td height="34">
									经办柜员:
								</td>
								<td>
									<span id="idclkno">黄兵</span>
								</td>
							</tr>
							<tr>
								<td height="34">
									查看图像:
								</td>
								<td>
									<input type="button" name="see" value="查看" class="btn1" />
								</td>
							</tr>
						</table>
				</tr>
			</table>
			<table width="40%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td align="center" valign="bottom">
						<label>
							<input type="button" name="Submit" value="通过" class="btn1" onClick="subForm('4')"/>
						</label>
						<label>
							<input type="button" name="Submit2" value="不通过" class="btn1" onClick="subForm('1')"/>
						</label>
						<label>
							<input type="button" name="Submit2" value="下一条" class="btn1"/>
						</label>
						<input type="button" name="Submit3" value="关闭"
							onClick="self.close()" class="btn1"/>
					</td>
				</tr>
			</table>
		</center>
	</body>
	<script type="text/javascript">
     getVoucherInfo();
  </script>

</html>